package com.ruoyi.equipment.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.entity.SysUser;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.equipment.mapper.TEquipmentLogMapper;
import com.ruoyi.equipment.domain.TEquipmentLog;
import com.ruoyi.equipment.service.ITEquipmentLogService;

/**
 * 设备日志Service业务层处理
 *
 * @author ruoyi
 * @date 2021-12-23
 */
@Service
public class TEquipmentLogServiceImpl implements ITEquipmentLogService {
    @Autowired
    private TEquipmentLogMapper tEquipmentLogMapper;

    /**
     * 查询设备日志
     *
     * @param userId 设备日志主键
     * @return 设备日志
     */
    @Override
    public TEquipmentLog selectTEquipmentLogByUserId(Integer userId) {
        return tEquipmentLogMapper.selectTEquipmentLogByUserId(userId);
    }

    /**
     * 查询设备日志列表
     *
     * @param tEquipmentLog 设备日志
     * @return 设备日志
     */
    @Override
    @DataScope(deptAlias = "d")
    public List<TEquipmentLog> selectTEquipmentLogList(TEquipmentLog tEquipmentLog) {
       List<TEquipmentLog> tEquipmentLogs= tEquipmentLogMapper.selectTEquipmentLogList(tEquipmentLog);
       return tEquipmentLogs;
    }

    /**
     * 新增设备日志
     *
     * @param tEquipmentLog 设备日志
     * @return 结果
     */
    @Override
    public int insertTEquipmentLog(TEquipmentLog tEquipmentLog) {
        return tEquipmentLogMapper.insertTEquipmentLog(tEquipmentLog);
    }

    /**
     * 修改设备日志
     *
     * @param tEquipmentLog 设备日志
     * @return 结果
     */
    @Override
    public int updateTEquipmentLog(TEquipmentLog tEquipmentLog) {
        return tEquipmentLogMapper.updateTEquipmentLog(tEquipmentLog);
    }

    /**
     * 批量删除设备日志
     *
     * @param userIds 需要删除的设备日志主键
     * @return 结果
     */
    @Override
    public int deleteTEquipmentLogByUserIds(Integer[] userIds) {
        return tEquipmentLogMapper.deleteTEquipmentLogByUserIds(userIds);
    }

    /**
     * 删除设备日志信息
     *
     * @param userId 设备日志主键
     * @return 结果
     */
    @Override
    public int deleteTEquipmentLogByUserId(Integer userId) {
        return tEquipmentLogMapper.deleteTEquipmentLogByUserId(userId);
    }

    /**
     * 根据设备id 选出该部门下所有用户
     *
     * @return 查询结果
     */
    @Override
    @DataScope(deptAlias = "d")
    public List<SysUser> getUserListByDeptId(SysUser sysUser) {
        List<SysUser> sysUserList = tEquipmentLogMapper.getUserListByDeptId(sysUser);
        return sysUserList;
    }
}
